////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2011-2012 www.iflytek.com. All Rights Reserved.
//  This software for customer relationship management system, developed by Iflytek-ZY-GCZX team.
//  Software code and design for the team, copy rights reserved.
////////////////////////////////////////////////////////////////////////////////

package com.iflytek.ci.main.controller;

import com.iflytek.framework.web.messages.AjaxMessage;
import com.iflytek.ci.qams.service.FullTextService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * <p>
 * 系统设置.
 * </p>
 *
 * @author poplar.yfyang
 * @version 1.0 2012-11-24 9:46 PM
 * @since JDK 1.5
 */
@Controller
@RequestMapping("/preferences")
public class PreferencesController extends BaseController {

	/** Serial version */
	private static final long serialVersionUID = -3617119370491712575L;
	/** 全文检索服务 */
	@Autowired
	private FullTextService fullTextService;

	@RequestMapping("/view")
	public String loadView() {
		return "/preferences/view";
	}

	/**
	 * 刷新全文索引目录，重新建立索引
	 *
	 * @return ajax请求
	 */
	@RequestMapping("/reload_index")
	@ResponseBody
	public AjaxMessage reload_fulltext_index() {
		boolean succ = fullTextService.reload_index();
		return succ ? ajax_info("索引目录重新建立成功!") : ajax_error("重新建立索引目录失败!");
	}
}
